import store from 'store';

export default {
	state: {
		giftInfo: store.get('giftInfo'),
		taskCategory: store.get('taskCategory'),
		showFooterBar: true
	},

	mutations: {
		SET_SELECT(state, { key, value }) {
			if (state[key] instanceof Array) {
				state[key].push(value);
			} else {
				state[key] = value;
			}

			store.set(key, value);
		},
		REMOVE_SELECT(state, key) {
			if (typeof key == 'string') {
				state[key] = null;
			} else {
				for (let i in key) {
					state[i] = null;
				}
			}

			store.remove(key);
		},
		CLEAR_SELECT(state) {
			state.address = null;
			state.coupon = null;
		}
	}
};
